package cj.web.yc.service;
/*
 *  
 *  
*/
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cj.web.yc.domain.StackRoom;
import cj.web.yc.domain.StackRoomItem;
import cj.web.yc.dao.StackRoomDAO;
import cj.web.yc.dao.StackRoomItemDAO;

/**
 * 
 * @author 
 *
 */
@Service
public class StackRoomService{

	@Autowired
    private StackRoomDAO stackRoomDAO;
	
	@Autowired
    private StackRoomItemDAO stackRoomItemDAO;
	
	/**
	 * 查询
	 * @param stackRoom
	 * @return stackRoomlis;size
	 */
	public Map query(StackRoom stackRoom){
		Map rep = new HashMap();
		List<StackRoom> stackRoomlis = stackRoomDAO.query(stackRoom);
		int size = stackRoomDAO.querySize(stackRoom); 
		rep.put("stackRoomlis", stackRoomlis);
		rep.put("size", size);
		return rep;
    }
	
	public StackRoom queryById(int id){
		StackRoom obj = stackRoomDAO.queryById(id);
		return obj;
    }
	
	public void create(StackRoom stackRoom){
		stackRoomDAO.create(stackRoom);
	}
	
	public void update(StackRoom stackRoom){
		stackRoomDAO.update(stackRoom);
	}
	
	public void deleteById(int id){
		stackRoomDAO.deleteById(id);
	}
	
	/**
	 * 查询
	 * @param stackRoomItem
	 * @return stackRoomItemlis;size
	 */
	public Map queryItem(StackRoomItem stackRoomItem){
		Map rep = new HashMap();
		List<StackRoomItem> stackRoomItemlis = stackRoomItemDAO.query(stackRoomItem);
		int size = stackRoomItemDAO.querySize(stackRoomItem); 
		rep.put("stackRoomItemlis", stackRoomItemlis);
		rep.put("size", size);
		return rep;
    }
	
	public StackRoomItem queryItemById(int id){
		StackRoomItem obj = stackRoomItemDAO.queryById(id);
		return obj;
    }
	
	public void createItem(StackRoomItem stackRoomItem){
		stackRoomItemDAO.create(stackRoomItem);
	}
	
	public void updateItem(StackRoomItem stackRoomItem){
		stackRoomItemDAO.update(stackRoomItem);
	}
	
	public void deleteItemById(int id){
		stackRoomItemDAO.deleteById(id);
	}
}